import { _decorator, Component, Node, EditBox } from "cc";
import websocket from "../../utils/websocket";
const { ccclass, property } = _decorator;

@ccclass("Chat")
export class Chat extends Component {
    @property(EditBox)
    private chatEditBox: EditBox = null;

    handleSendChat() {
        const msg = this.chatEditBox.string.trim();
        if (msg) {
            websocket.send("talk", { msg });
        }
        this.chatEditBox.string = "";
    }
}
